package com.flyfox.component.config;

import com.flyfox.jfinal.config.JflyfoxConfig;
import com.flyfox.modules.dict.DictCache;
import com.flyfox.modules.user.UserCache;
import com.flyfox.modules.user.UserInterceptor;
import com.jfinal.config.Interceptors;

/**
 * API引导式配置
 */
public class BaseConfig extends JflyfoxConfig {

	/**
	 * 配置全局拦截器
	 */
	public void configInterceptor(Interceptors me) {
		// 用户认证
		me.add(new UserInterceptor());
		// session model转换
		super.configInterceptor(me);
	}

	/**
	 * 初始化
	 */
	@Override
	public void afterJFinalStart() {
		reset();
	}

	public static void reset() {
		DictCache.init();
		UserCache.init();
	}

}
